home *** CD-ROM | disk | FTP | other *** search
- /* Dice: dcc -l0 -mD dpk.o OBJScreen.c -o OBJScreen
- **
- ** Opens a screen according to the settings in an object file. See
- ** GMS:Source/Asm/Objects/OBJ.Screen.s for object definitions.
- */
-
- #include <proto/dpkernel.h>
- #include <pragmas/objects_pragmas.h>
- #include <system/debug.h>
-
- BYTE *ProgName = "Object Demo";
- BYTE *ProgAuthor = "Paul Manias";
- BYTE *ProgDate = "18 October 1997";
- BYTE *ProgCopyright = "DreamWorld Productions (c) 1997. Freely distributable.";
- BYTE *ProgShort = "External object demonstration.";
-
- struct Module *OBJModule;
- APTR OBJBase;
-
- LONG main(void)
- {
- struct GScreen *Screen;
- struct Picture *Picture;
- struct JoyData *joydata;
- struct FileName ObjFilename = { ID_FILENAME, "GMS:demos/data/OBJ.Screen" };
- APTR OBJFile;
-
- if (OBJModule = OpenModule(MOD_OBJECTS,NULL)) {
- OBJBase = OBJModule->ModBase;
- if (OBJFile = Load(&ObjFilename,ID_OBJECTFILE)) {
- if (Picture = GetFileObject(OBJFile,"Picture")) {
- if (joydata = Init(Get(ID_JOYDATA),NULL)) {
- if (Init(Picture,NULL)) {
- if (Screen = Get(ID_SCREEN)) {
- CopyStructure(Picture,Screen);
- Screen->MemPtr1 = Picture->Bitmap->Data;
- Screen->Attrib = CENTRE;
-
- if (Init(Screen,NULL)) {
- Display(Screen);
- while (!(joydata->Buttons & JD_LMB)) {
- Query(joydata);
- WaitAVBL();
- }
- }
-
- Free(Screen);
- }
- Free(Picture);
- }
- Free(joydata);
- }
- }
- Free(OBJFile);
- }
- Free(OBJModule);
- }
-
- return(ERR_OK);
- }
-
-